<html>
<body>
<script>
function debug(msg) {
  var console = document.getElementById('console');
  var line = document.createElement('div');
  line.textContent = msg;
  console.appendChild(line);
}

function editingTest() {
    if (!window.testRunner)
        return;

    testRunner.dumpAsText();
    testRunner.waitUntilDone();

    // Drag a URL text in the source
    var source = document.getElementById("source");
    source.focus();
    source.setSelectionRange(0, source.value.length);
    x = source.offsetLeft + 10;
    y = source.offsetTop + source.offsetHeight / 2;
    eventSender.mouseMoveTo(x, y);
    eventSender.mouseDown();
    // and drop it off to the destination field.
    var destination = document.getElementById("destination");
    eventSender.leapForward(500);
    eventSender.mouseMoveTo(destination.offsetLeft + 10, destination.offsetTop + destination.offsetHeight / 2);
    eventSender.mouseUp();

    var result = destination.value;
    debug(result == 'http://www.apple.com/' ? 'PASS' : 'FAIL: expected value="http://www.apple.com/", actual value="' + result + '"');

    testRunner.notifyDone();
}
</script>
<p>This tests text selection drag for a URL-like text.</p>
To test this by hand, select all of the text in this input: <input id=source value="http://www.apple.com/"><br>
and drag/drop it into this input: <input id=destination>
<br><br>If you see that the text "http://www.apple.com/" was put in the second box, then the test passed.
<div id=console></div>
<script>editingTest();</script>
</body>
</html>
